<template>
    <div>
        propSon1: {{ propSon1 }} 
        sonDataNum1: {{ sonDataNum1 }}
        <input type="number" @input="sonchangedata(1,$event)">   
        propSon2: {{ propSon2 }} 
        sonDataNum2: {{ sonDataNum2 }}
        <input type="number" @input="sonchangedata(2,$event)"><br>
        插槽num1的值为：<slot name="num1">query.num1:默认为1</slot><br>
        插槽num2的值为：<slot name="num2">query.num2:默认为2</slot>
    </div>   
</template>

<script>
export default {
    name:'helloSon',
    props:{
        propSon1: {
            type:Number
        },
        propSon2:{
            type:Number
        }
    },
    data:function() {
        return {
            sonDataNum1:this.propSon1,
            sonDataNum2:this.propSon2
        }
    },
    methods:{
        sonchangedata(targetval,event) {
            if(targetval==1){
                this.sonDataNum1=parseInt(event.target.value);
                this.$emit("faChangeData",this.sonDataNum1,targetval)
            }else{
                this.sonDataNum2=parseInt(event.target.value);
                this.$emit("faChangeData",this.sonDataNum2,targetval)
            }
            
        }
    }
        
}
</script>
<style scoped>

</style>